/* ****************************************************************************
 *
 * Copyright (c) Microsoft Corporation. 
 *
 * This source code is subject to terms and conditions of the Microsoft Public License. A 
 * copy of the license can be found in the License.html file at the root of this distribution. If 
 * you cannot locate the  Microsoft Public License, please send an email to 
 * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound 
 * by the terms of the Microsoft Public License.
 *
 * You must not remove this notice, or any other, from this software.
 *
 *
 * ***************************************************************************/

namespace Microsoft.Scripting.Ast {
    public partial class TreeRewriter {
        private delegate Expression RewriterDelegate(TreeRewriter rewriter, Expression expression);

        private static readonly RewriterDelegate[] _Rewriters = new RewriterDelegate[] {
            #region Generated AST Rewriter Delegates

            // *** BEGIN GENERATED CODE ***
            // generated by function: gen_scripting_rewriter_delegates from: generate_tree.py

            DefaultRewriteBinaryExpression,                             //    Add
            DefaultRewriteBinaryExpression,                             //    AddChecked
            DefaultRewriteBinaryExpression,                             //    And
            DefaultRewriteBinaryExpression,                             //    AndAlso
            DefaultRewriteUnaryExpression,                              //    ArrayLength
            DefaultRewriteBinaryExpression,                             //    ArrayIndex
            DefaultRewriteMethodCallExpression,                         //    Call
            DefaultRewriteBinaryExpression,                             //    Coalesce
            DefaultRewriteConditionalExpression,                        //    Conditional
            DefaultRewriteConstantExpression,                           //    Constant
            DefaultRewriteUnaryExpression,                              //    Convert
            DefaultRewriteUnaryExpression,                              //    ConvertChecked
            DefaultRewriteBinaryExpression,                             //    Divide
            DefaultRewriteBinaryExpression,                             //    Equal
            DefaultRewriteBinaryExpression,                             //    ExclusiveOr
            DefaultRewriteBinaryExpression,                             //    GreaterThan
            DefaultRewriteBinaryExpression,                             //    GreaterThanOrEqual
            DefaultRewriteInvocationExpression,                         //    Invoke
            DefaultRewriteLambdaExpression,                             //    Lambda
            DefaultRewriteBinaryExpression,                             //    LeftShift
            DefaultRewriteBinaryExpression,                             //    LessThan
            DefaultRewriteBinaryExpression,                             //    LessThanOrEqual
                                                                        // ** ListInit
            DefaultRewriteMemberExpression,                             //    MemberAccess
                                                                        // ** MemberInit
            DefaultRewriteBinaryExpression,                             //    Modulo
            DefaultRewriteBinaryExpression,                             //    Multiply
            DefaultRewriteBinaryExpression,                             //    MultiplyChecked
            DefaultRewriteUnaryExpression,                              //    Negate
            DefaultRewriteUnaryExpression,                              //    UnaryPlus
            DefaultRewriteUnaryExpression,                              //    NegateChecked
            DefaultRewriteNewExpression,                                //    New
            DefaultRewriteNewArrayExpression,                           //    NewArrayInit
            DefaultRewriteNewArrayExpression,                           //    NewArrayBounds
            DefaultRewriteUnaryExpression,                              //    Not
            DefaultRewriteBinaryExpression,                             //    NotEqual
            DefaultRewriteBinaryExpression,                             //    Or
            DefaultRewriteBinaryExpression,                             //    OrElse
            DefaultRewriteParameterExpression,                          //    Parameter
            DefaultRewriteBinaryExpression,                             //    Power
            DefaultRewriteUnaryExpression,                              //    Quote
            DefaultRewriteBinaryExpression,                             //    RightShift
            DefaultRewriteBinaryExpression,                             //    Subtract
            DefaultRewriteBinaryExpression,                             //    SubtractChecked
            DefaultRewriteUnaryExpression,                              //    TypeAs
            DefaultRewriteTypeBinaryExpression,                         //    TypeIs
            DefaultRewriteActionExpression,                             //    ActionExpression
            DefaultRewriteAssignmentExpression,                         //    Assign
            DefaultRewriteBlock,                                        //    Block
            DefaultRewriteBreakStatement,                               //    BreakStatement
            DefaultRewriteLambdaExpression,                             //    Generator
            DefaultRewriteContinueStatement,                            //    ContinueStatement
            DefaultRewriteDeleteExpression,                             //    Delete
            DefaultRewriteDoStatement,                                  //    DoStatement
            DefaultRewriteEmptyStatement,                               //    EmptyStatement
            DefaultRewriteLabeledStatement,                             //    LabeledStatement
            DefaultRewriteLocalScopeExpression,                         //    LocalScope
            DefaultRewriteLoopStatement,                                //    LoopStatement
            DefaultRewriteUnaryExpression,                              //    OnesComplement
            DefaultRewriteReturnStatement,                              //    ReturnStatement
            DefaultRewriteScopeExpression,                              //    Scope
            DefaultRewriteSwitchStatement,                              //    SwitchStatement
            DefaultRewriteThrowStatement,                               //    ThrowStatement
            DefaultRewriteTryStatement,                                 //    TryStatement
            DefaultRewriteVariableExpression,                           //    Variable
            DefaultRewriteYieldStatement,                               //    YieldStatement
            DefaultRewriteExtensionExpression,                          //    Extension

            // *** END GENERATED CODE ***

            #endregion
        };

        #region Generated DLR AST Rewriter

        // *** BEGIN GENERATED CODE ***
        // generated by function: gen_scripting_rewriter from: generate_tree.py

        // ActionExpression
        protected virtual Expression Rewrite(ActionExpression node) { return node; }

        // AssignmentExpression
        protected virtual Expression Rewrite(AssignmentExpression node) { return node; }

        // BinaryExpression
        protected virtual Expression Rewrite(BinaryExpression node) { return node; }

        // Block
        protected virtual Expression Rewrite(Block node) { return node; }

        // BreakStatement
        protected virtual Expression Rewrite(BreakStatement node) { return node; }

        // ConditionalExpression
        protected virtual Expression Rewrite(ConditionalExpression node) { return node; }

        // ConstantExpression
        protected virtual Expression Rewrite(ConstantExpression node) { return node; }

        // ContinueStatement
        protected virtual Expression Rewrite(ContinueStatement node) { return node; }

        // DeleteExpression
        protected virtual Expression Rewrite(DeleteExpression node) { return node; }

        // DoStatement
        protected virtual Expression Rewrite(DoStatement node) { return node; }

        // EmptyStatement
        protected virtual Expression Rewrite(EmptyStatement node) { return node; }

        // InvocationExpression
        protected virtual Expression Rewrite(InvocationExpression node) { return node; }

        // LabeledStatement
        protected virtual Expression Rewrite(LabeledStatement node) { return node; }

        // LambdaExpression
        protected virtual Expression Rewrite(LambdaExpression node) { return node; }

        // LocalScopeExpression
        protected virtual Expression Rewrite(LocalScopeExpression node) { return node; }

        // LoopStatement
        protected virtual Expression Rewrite(LoopStatement node) { return node; }

        // MemberExpression
        protected virtual Expression Rewrite(MemberExpression node) { return node; }

        // MethodCallExpression
        protected virtual Expression Rewrite(MethodCallExpression node) { return node; }

        // NewArrayExpression
        protected virtual Expression Rewrite(NewArrayExpression node) { return node; }

        // NewExpression
        protected virtual Expression Rewrite(NewExpression node) { return node; }

        // ParameterExpression
        protected virtual Expression Rewrite(ParameterExpression node) { return node; }

        // ReturnStatement
        protected virtual Expression Rewrite(ReturnStatement node) { return node; }

        // ScopeExpression
        protected virtual Expression Rewrite(ScopeExpression node) { return node; }

        // SwitchStatement
        protected virtual Expression Rewrite(SwitchStatement node) { return node; }

        // ThrowStatement
        protected virtual Expression Rewrite(ThrowStatement node) { return node; }

        // TryStatement
        protected virtual Expression Rewrite(TryStatement node) { return node; }

        // TypeBinaryExpression
        protected virtual Expression Rewrite(TypeBinaryExpression node) { return node; }

        // UnaryExpression
        protected virtual Expression Rewrite(UnaryExpression node) { return node; }

        // VariableExpression
        protected virtual Expression Rewrite(VariableExpression node) { return node; }

        // YieldStatement
        protected virtual Expression Rewrite(YieldStatement node) { return node; }

        // CatchBlock
        protected virtual CatchBlock Rewrite(CatchBlock node) { return node; }

        // IfStatementTest
        protected virtual IfStatementTest Rewrite(IfStatementTest node) { return node; }

        // SwitchCase
        protected virtual SwitchCase Rewrite(SwitchCase node) { return node; }

        // *** END GENERATED CODE ***

        #endregion
    }
}
